package leetcode.day;


//
public class T {
    public static void main(String[] args) {
        int i = 0, sum = 0;
        sum = sum(i);
        System.out.println(sum);
        System.out.println(Integer.bitCount(7));
        System.out.println(bitCount(7));
    }

    private static int sum(int i) {
        if (i == 100) {
            return 100;
        }
        return i + sum(i + 1);
    }

    public static int bitCount(int n){
        int count=0;
        while (n>0){
            if (n%2==1){
                count++;
            }
            n/=2;
        }
        return count;
    }

}
